import React, { Component } from 'react'
import {
    View, TextInput, StyleSheet, Text, Image, SafeAreaView, Navigator, TouchableOpacity, TouchableHighlight, Button, ScrollView, KeyboardAvoidingView,
    TextView, FlatList,
    ActivityIndicator,
    RefreshControl
} from 'react-native'
import {
    width,
    titleHeight,
    deviceWidth,
    unitWidth,
    statusBarHeight,
    reallySize,
} from '../../utils/Global';
import NavBar from '../../components/PublicHeader';
import { Images } from '../../public/images/images';
import { Tabs } from '@ant-design/react-native';
import { Constant } from '../../public/js/constant';
import fetchWebApi from '../../public/WebApi/fetchBase';
import { GET_USER_MESSAGES, POST_USER_SEARCH, POST_USER_LOOKFORSB, POST_SOCIALCIRCLE, POST_DELETERECORD, POST_GISTORY, POST_SEARCH_FILTRATE } from '../../public/WebApi/searchApis';
import getStorageValue from '../../utils/getStorageValue';
import LinearGradient from 'react-native-linear-gradient';
import { object } from 'prop-types';
import Layer from '../../utils/Layer';
import Loading from '../../components/Loading';
import { publicMethodEllipsis, messageEllipsis } from '../../utils/publicMethodList'
const { TabPane } = Tabs

export default class search extends Component {
    constructor(props) {
        super(props)
        this.state = {
            searchText: this.props.navigation.state.params.searchText,//输入框的内容
            judges: 0,//判断是否输入值
            //切换数据
            tabs: [
                { title: '找人' },
                { title: '找社圈' },
                { title: '找公司' }
            ],
            lookforsbsisok: 0,
            data: [],//热门搜索
            DATA: [],//搜索列表
            DATAS: [],//找人
            DATASS: [],//找公司
            Socialcircle: [],//社圈,
            likeFlag: false,
            defaultTab: true,
            selectImage1: [],
            isLoading: false,
            page: 0,
            pageSize: 4,
            tempAddDatas: [],
            isRefreshing: false,
            status: 1
        }
    }

    componentDidMount = () => {
        this.Topsearch()
        this.getUserMaillistS()
        // this.Socialcircle()

    }
    componentDidUpdate = () => {
    }
    //赋值搜索框里的内容
    onChangeText(text) {
        this.setState({
            searchText: text,
        }),
            console.log(this.state.searchText);
        if (this.state.searchText == '') {
            this.setState({
                judges: 0,
                DATAS: [],
                DATASS: [],
                Socialcircle: []
            })
        }
    };
    setMorKm(m) {
        var n = ''
        if (m) {
            if (m >= 1000) {
                n = (m / 1000).toFixed(2) + 'km'
            } else {
                n = m + 'm'
            }
        } else {
            n = '0m'
        }
        return n
    }
    sex(sex) {
        return (
            sex == '男' ? <Image
                style={styles.introduce_img}
                source={Images.Frame2}
            /> : null ||
                sex == '女' ? <Image
                style={styles.introduce_img}
                source={Images.Frame3}
            /> : null || sex == '' == null ? null : null
        )
    }
    // 热门搜索
    async Topsearch() {
        const res = await fetchWebApi(GET_USER_MESSAGES, { token: await getStorageValue(Constant.TOKEN) }, 'GET');
        // console.log("########## Topsearch");
        // console.log(res);
        if (res.status == 200) {

            this.setState({
                data: res.data
            })
        } else {
            Layer.showMsg(res.msg);
        }

    }
    // 搜索列表
    async getUserMaillistS() {
        const res = await fetchWebApi(POST_USER_SEARCH, { token: await getStorageValue(Constant.TOKEN) }, 'POST');
        // console.log('##################################')
        // console.log(res)
        if (res.status == 200) {

            this.setState({
                DATA: res.data
            })
        } else {
            Layer.showMsg(res.msg);
        }
    }
    // 找人
    async lookforsb() {

        Loading.show()
        const res = await fetchWebApi(POST_USER_LOOKFORSB, { token: await getStorageValue(Constant.TOKEN), nicName: this.state.searchText }, 'POST');
        console.log('33333333333333')
        console.log(res.data)
        if (res.status == 200) {
            res.data.map((item, index) => {
                if (item.userType == 0) {
                    this.state.DATAS.push(item)
                } else {
                    this.state.DATASS.push(item)
                }
            })
            this.setState({

            })
        } else {
            // Layer.showMsg(res.msg);
        }
        Loading.hide()

    }
    // 社圈
    async Socialcircle() {

        // Loading.show()
        const res = await fetchWebApi(POST_SOCIALCIRCLE, { token: await getStorageValue(Constant.TOKEN), blurry: this.state.searchText, page: this.state.page, pageSize: this.state.pageSize }, 'POST');
        console.log('############################################s')
        console.log(res.data)
        if (res.status == 200) {
            if (this.state.page == 0) {
                this.setState({
                    Socialcircle: res.data.businessList
                })
            } else {
                this.setState({
                    tempAddDatas: res.data.businessList
                })
            } if (res.data.businessList.length == 0) {
                this.setState({
                    status: 0
                })
            }
        } else {
            Layer.showMsg(res.msg);
        }
        Loading.hide()

    }

    // 删除历史搜索
    async Deleterecord() {
        const res = await fetchWebApi(POST_GISTORY, { token: await getStorageValue(Constant.TOKEN), count: 1 }, 'POST');
        // console.log("########## Topsearch");
        console.log(res);
        if (res.status == 200) {
            this.setState({
                DATA: []
            })
        } else {
            // console.log(msg)
            Layer.showMsg(res.msg);
        }
    }
    //根据传过来的数量评星
    reputations(index) {
        return (
            parseInt(index) == 1 ?
                <>
                    <Text style={{ color: '#FDE400' }}>★</Text>
                    <Text style={{ color: '#C4C4C4' }}>★</Text>
                    <Text style={{ color: '#C4C4C4' }}>★</Text>
                    <Text style={{ color: '#C4C4C4' }}>★</Text>
                    <Text style={{ color: '#C4C4C4' }}>★</Text>
                </> : parseInt(index) == 2 ?
                    <>
                        <Text style={{ color: '#FDE400' }}>★</Text>
                        <Text style={{ color: '#FDE400' }}>★</Text>
                        <Text style={{ color: '#C4C4C4' }}>★</Text>
                        <Text style={{ color: '#C4C4C4' }}>★</Text>
                        <Text style={{ color: '#C4C4C4' }}>★</Text>
                    </> : parseInt(index) == 3 ?
                        <>
                            <Text style={{ color: '#FDE400' }}>★</Text>
                            <Text style={{ color: '#FDE400' }}>★</Text>
                            <Text style={{ color: '#FDE400' }}>★</Text>
                            <Text style={{ color: '#C4C4C4' }}>★</Text>
                            <Text style={{ color: '#C4C4C4' }}>★</Text>
                        </> : parseInt(index) == 4 ?
                            <>
                                <Text style={{ color: '#FDE400' }}>★</Text>
                                <Text style={{ color: '#FDE400' }}>★</Text>
                                <Text style={{ color: '#FDE400' }}>★</Text>
                                <Text style={{ color: '#FDE400' }}>★</Text>
                                <Text style={{ color: '#C4C4C4' }}>★</Text>
                            </> : parseInt(index) == 5 ?
                                <>
                                    <Text style={{ color: '#FDE400' }}>★</Text>
                                    <Text style={{ color: '#FDE400' }}>★</Text>
                                    <Text style={{ color: '#FDE400' }}>★</Text>
                                    <Text style={{ color: '#FDE400' }}>★</Text>
                                    <Text style={{ color: '#FDE400' }}>★</Text>
                                </> : parseInt(index) == 0 ?
                                    <>
                                        <Text style={{ color: '#C4C4C4' }}>★</Text>
                                        <Text style={{ color: '#C4C4C4' }}>★</Text>
                                        <Text style={{ color: '#C4C4C4' }}>★</Text>
                                        <Text style={{ color: '#C4C4C4' }}>★</Text>
                                        <Text style={{ color: '#C4C4C4' }}>★</Text>
                                    </> : null
        )
    }

    onClick() {
    }
    Inputresults() {
    }
    handleRefresh = () => {
        this.setState({
            page: 0,
            isRefreshing: true,//tag,下拉刷新中，加载完全，就设置成flase
            Socialcircle: []
        });
        this.Socialcircle()
        this.setState({
            isRefreshing: false,
            status: 1
        })
    }
    loadData(pullUp) {
        this.setState({
            page: this.state.page + this.state.pageSize
        })
        this.Socialcircle();
        setTimeout(() => {
            var dataArray = []
            // var page = 0
            if (pullUp) {

                dataArray = this.state.Socialcircle,
                    dataArray = [...this.state.Socialcircle, ...this.state.tempAddDatas]
            } else if (this.state.tempAddDatas.length == 0) {
                this.genIndicator = false,
                    this.loadData = false
            }
            this.setState({

                Socialcircle: dataArray,
                isLoading: false,
            })

            // console.log(this.state.mySocialCircleList);
            // console.log("###########tempAddDatas");
            // console.log(this.state.tempAddDatas);
            // console.log(this.state.page);
            // this.getSocialCircleList()

        }, 1000);
    }
    genIndicator() {
        return <View style={styles.IndicatorContainer}>
            <ActivityIndicator  //显示一个圆形的 loading 提示符号。
                style={styles.Indicator}
                size={"small"}
                animating={true}
                color={'gray'}
            />
            <Text>正在加载更多</Text>
        </View>
    }
    _renderItem1(data) {
        // console.log(data.item.businessId);
        return (
            // <>
            //   {
            //     data
            //       .map((item, index) => (
            <View style={styles.mySocialCircle} >
                <View style={styles.uploadBoxContainer}>
                    <TouchableOpacity onPress={() => {
                        this.props.navigation.push('socialcircleDetails', { businessId: data.item.businessId })
                    }}>
                        <View style={styles.uploadBoxHeadPortrait}>
                            <View style={styles.headPortraitBox}>
                                <Image
                                    source={data.item.userInfoAvatar == null ? require("../../assets/images/socialcircle/defaultHeadpor.png") : { uri: data.item.userInfoAvatar }}
                                    style={styles.headPortrait}
                                />
                            </View>

                            <View style={styles.headPortraitText}>
                                <View style={{ display: 'flex', flexDirection: 'row', justifyContent: 'flex-start' }}>
                                    <Text style={styles.headPortraitName}>
                                        {data.item.userInfoName}
                                    </Text>
                                    <Image style={{ marginTop: 3, marginLeft: 3, width: 18, height: 18 }} source={data.item.userType == 1 ? require('../../assets/images/maillist/enterprise.png') : null} />
                                </View>
                                <Text style={styles.headPortraitTime}>
                                    {data.item.businessCreateTime}
                                </Text>
                            </View>
                        </View>
                        {/* 社圈标题 */}
                        {data.item.businessTitle != '' ? <View style={styles.textContent}>
                            <Text style={styles.textContentFont}>
                                {data.item.businessTitle}
                            </Text>

                        </View> : null}
                        {/* 标签 */}
                        {data.item.businessLabel != null && data.item.businessLabel.length != 0 ? <View style={styles.labelRow}>
                            {data.item.businessLabel.map((item, index) => (
                                <View key={index} style={{ backgroundColor: "rgba(223,239,255, 0.19)", paddingLeft: 2, paddingRight: 2, justifyContent: 'center', alignItems: 'center', marginRight: 5, borderColor: 'rgba(24, 144, 255, 1)', borderWidth: 1, borderRadius: 2 }}>
                                    <Text style={styles.textContentLabel}>
                                        #{item}
                                    </Text>
                                </View>
                            ))}
                        </View> : null}

                        {data.item.businessFilePath != null && data.item.businessFilePath.length != 0 ? <View style={styles.row}>
                            {/* 发布的图片 */}
                            {data.item.businessFilePath.slice(0, 3).map((item, index) => (
                                <View style={(index + 1) % 3 == 0 ? styles.item : styles.itemMr} key={index}>
                                    <Image
                                        style={styles.SystemPrompt}
                                        source={{ uri: item }}
                                    />
                                </View>
                            ))}
                        </View> : null}
                        {/* 定位信息 */}
                        {data.item.place ? <TouchableOpacity style={styles.locationBox}>
                            <Image source={require("../../assets/images/socialcircle/location2.png")} style={styles.locationBoxImage}></Image>
                            <Text style={styles.locationBoxFont}>
                                {data.item.place}
                            </Text>
                        </TouchableOpacity> : <View style={{ margin: 3 }}></View>}

                        {/* 阅读数量 */}
                        <View style={styles.timesBox}>
                            <View style={styles.timesViews}>
                                <Image source={require("../../assets/images/socialcircle/browse.png")} style={styles.timesViewsImage}></Image>
                                <Text style={styles.timesViewsFont}>
                                    {data.item.countBrowse} 阅读
                                </Text>
                            </View>
                            <View style={styles.likeCommentBox}>
                                {/* 喜欢数量 */}
                                <View style={styles.likeBox} onPress={() => {
                                    // console.log(item.businessId);
                                    this.postSocialCirclePraise(data.item.businessId)
                                    this.setState({
                                        // flag: item.likeFlag = !item.likeFlag
                                    })
                                }}>
                                    <Image source={data.item.ifCount == 1 ? require("../../assets/images/socialcircle/like.png") : require("../../assets/images/socialcircle/like_off.png")} style={styles.likeBoxImage}></Image>
                                    <Text style={styles.likeBoxFont}>
                                        {data.item.countGive}
                                    </Text>
                                </View>
                                {/* 评论数 */}
                                <View style={styles.commentBox}>
                                    <Image source={require("../../assets/images/socialcircle/comment.png")} style={styles.commentBoxImage}></Image>
                                    <Text style={styles.commentBoxFont}>
                                        {data.item.countComments}
                                    </Text>
                                </View>
                            </View>
                        </View>
                    </TouchableOpacity>

                </View>
            </View>
            //       ))}
            // </>
        )
    }

    render() {
        const noSocialCircle =
            <>

                {/* 底部提示 */}
                <View style={styles.bottom_container}>
                    <Text style={styles.bottom_text}>没有更多了哦~</Text>
                </View>
            </>
        const { tabs } = this.state
        //在没有输入的情况下的模块
        const canmint = <View style={this.state.judges == 0 ? styles.judgess : styles.judge}>
            <View style={styles.dexj0}>
                <Text style={styles.Searchlistmodule}>搜索列表</Text><TouchableOpacity onPress={() => { this.Deleterecord() }} style={{}}><Image source={Images.laji} style={{ width: 15, height: 15, resizeMode: 'contain' }}></Image></TouchableOpacity>
            </View>
            <View style={styles.Searchlisthss}>
                {
                    this.state.DATA.map((item, index) => {
                        return (
                            <Text key={index} style={styles.Searchrecords} onPress={() => { this.setState({ searchText: item.history }) }}>{item.history}</Text>
                        )

                    })
                }
            </View>
            <View style={styles.dexj}>
                <Text style={styles.tailos}>热门搜索</Text>
                {/* <Image source={Images.laji} style={{ marginTop: 4 }}></Image> */}
            </View>


            <View style={styles.Searchlisthss}>
                {
                    this.state.data.slice(0, 6).map((item, index) => {
                        return (
                            <Text key={index} style={styles.Searchrecords} onPress={() => { this.setState({ searchText: item.title }) }}>{item.title}</Text>

                        )
                    })
                }
            </View>


        </View>
        //输入结果
        //找公司
        const FindenterprisePHP = this.state.lookforsbsisok == 2 ? <ScrollView style={styles.learnView} showsVerticalScrollIndicator={false} >
            {/* <ScrollView> */}
            {
                this.state.DATASS.map((item, index) => (
                    <TouchableOpacity key={index} style={styles.middle} onPress={() => {

                        this.props.navigation.push('introduces', {
                            id: item.userInfoId,
                            refresh: () => {
                                // this.lookforsb(),
                                //     this.setState({
                                //         DATAS: [],
                                //         DATASS: []
                                //     })
                            },
                            remarksName: item.nickName
                        })
                    }}>
                        <View style={{ width: "20%" }}>
                            <Image source={{ uri: item.urlAddress }} style={{ width: 60, height: 60, borderRadius: 6 }}></Image>
                        </View>
                        <View style={{ justifyContent: 'space-between', display: 'flex', flexDirection: 'column', width: '75%', height: 60, marginLeft: '5%' }}>
                            <View style={{ justifyContent: 'space-between', display: 'flex', alignItems: 'center', flexDirection: 'row' }}>
                                <Text style={styles.Personalhomepagepicture}>{item.userName}
                                    {item.userType == 0 ? this.sex(item.sex) : <>
                                        <Image style={{ width: 18, height: 18, marginLeft: 5, resizeMode: "contain" }} source={require('../../assets/images/maillist/enterprise.png')} />
                                    </>}
                                </Text>

                                <View style={{ display: 'flex', flexDirection: 'row', marginLeft: 10 }}>
                                    <Text style={{ color: 'rgba(0, 0, 0, 0.45)' }}>诚信 </Text>
                                    {/* 诚信等级 */}
                                    {this.reputations(item.creditLevel)}
                                </View>
                            </View>
                            <View style={styles.Personalcirculation}>
                                <View style={{ display: 'flex', flexDirection: 'row' }}>
                                    {item.labelNames == null ? null : item.labelNames.map((item, index) => (
                                        <Text key={index} style={item == null ? null : styles.middleText}>{publicMethodEllipsis(item)}</Text>
                                    ))}
                                </View>
                                <Text style={{ marginLeft: 10 }}><Image source={require("../../assets/images/socialcircle/location3.png")} style={styles.locationBoxImage}></Image>{this.setMorKm(item.distance)}</Text>
                            </View>
                        </View>
                    </TouchableOpacity>
                ))

            }
            {/* </ScrollView> */}
        </ScrollView> : null
        //社圈
        const mySocialCircle = this.state.lookforsbsisok == 1 ?
            <>
                {
                    <FlatList
                        // refreshing={this.refreshing}
                        data={this.state.Socialcircle}
                        renderItem={(data) => this._renderItem1(data)}
                        keyExtractor={(item, index) => String(index)}
                        numColumns={1}//一行一列
                        ListFooterComponent={() => this.state.status == 1 ? this.genIndicator() : noSocialCircle}//底部组件
                        onEndReached={//列表被滚动到距离内容最底部不足onEndReachedThreshold设置的的距离时调用。
                            () => {
                                this.loadData(true);
                            }
                        }
                        onEndReachedThreshold={0.01}//0.5 表示距离内容最底部的距离为当前列表可见长度的一半时触发onEndReached回调
                        refreshControl={
                            <RefreshControl
                                refreshing={this.state.isRefreshing}
                                onRefresh={this.handleRefresh.bind(this)}//因为涉及到this.state
                                colors={['#ff0000', '#00ff00', '#0000ff', '#3ad564']}
                                progressBackgroundColor="#ffffff"
                            />
                        }
                    />
                }
            </> : null
        //找人
        const FindsomeonePHP = this.state.lookforsbsisok == 0 ? <ScrollView style={styles.learnView} showsVerticalScrollIndicator={false} >
            {/* <ScrollView> */}
            {
                this.state.DATAS.map((item, index) => (
                    <TouchableOpacity key={index} style={styles.middle} onPress={() => {

                        this.props.navigation.push('introduces', {
                            id: item.userInfoId,
                            refresh: () => {
                                // this.lookforsb(),
                                //     this.setState({
                                //         DATAS: [],
                                //         DATASS: []
                                //     })
                            },
                            remarksName: item.nickName
                        })
                    }}>
                        <View style={{ width: "20%" }}>
                            <Image source={{ uri: item.urlAddress }} style={{ width: 60, height: 60, borderRadius: 6 }}></Image>
                        </View>
                        <View style={{ justifyContent: 'space-between', display: 'flex', flexDirection: 'column', width: '75%', height: 60, marginLeft: '5%' }}>
                            <View style={{ justifyContent: 'space-between', display: 'flex', alignItems: 'center', flexDirection: 'row' }}>
                                <Text style={styles.Personalhomepagepicture}>{item.userName}
                                    {item.userType == 0 ? this.sex(item.sex) : <>
                                        <Image style={{ width: 18, height: 18, marginLeft: 5, resizeMode: "contain" }} source={require('../../assets/images/maillist/enterprise.png')} />
                                    </>}
                                    {/* <Image style={{ width: 18, height: 18 }} source={item.userType == 0 ? null : require('../../assets/images/maillist/enterprise.png')} /> */}
                                </Text>

                                <View style={{ display: 'flex', flexDirection: 'row', marginLeft: 10 }}>
                                    <Text style={{ color: 'rgba(0, 0, 0, 0.45)' }}>诚信 </Text>
                                    {/* 诚信等级 */}
                                    {this.reputations(item.creditLevel)}
                                </View>
                            </View>
                            <View style={styles.Personalcirculation}>
                                <View style={{ display: 'flex', flexDirection: 'row' }}>
                                    {item.labelNames == null ? null : item.labelNames.map((item, index) => (
                                        <Text key={index} style={item == null ? null : styles.middleText}>{publicMethodEllipsis(item)}</Text>
                                    ))}
                                </View>
                                <Text style={{ marginLeft: 10 }}><Image source={require("../../assets/images/socialcircle/location3.png")} style={styles.locationBoxImage}></Image>{this.setMorKm(item.distance)}</Text>
                            </View>
                        </View>
                    </TouchableOpacity>
                ))

            }
            {/* </ScrollView> */}
        </ScrollView> : null
        //无搜索用户时显示
        const Subscribe = this.state.DATAS.length == 0 && this.state.judges == 1 && this.state.lookforsbsisok == 0 ?
            <>
                <View style={styles.subscribe_style}>
                    <Text style={styles.no_subscribe_text}>您查找的用户不存在,请核对正确的信息~</Text>
                </View>
            </> : null

        //无搜索社圈时显示
        const Subscribe1 = this.state.Socialcircle.length == 0 && this.state.judges == 1 && this.state.lookforsbsisok == 1 ?
            <>
                <View style={styles.subscribe_style}>
                    <Text style={styles.no_subscribe_text}>您查找的社圈不存在,请核对正确的信息~</Text>
                </View>
            </> : null

        //无搜索公司时显示
        const Subscribe2 = this.state.DATASS.length == 0 && this.state.judges == 1 && this.state.lookforsbsisok == 2 ?
            <>
                <View style={styles.subscribe_style}>
                    <Text style={styles.no_subscribe_text}>您查找的机构不存在,请核对正确的信息~</Text>
                </View>
            </> : null

        const bothNull = this.state.judges == 1 ?
            <>
                <View style={styles.subscribe_style}>
                    <Image source={require("../../assets/images/search/bothNull.png")} style={styles.bothNullImg} />
                    <Text style={styles.no_subscribe_text}>搜索内容为空，请重新搜索</Text>
                </View>
            </> : null
        return (
            <View style={styles.comment}>
                <Loading />
                <View style={styles.statusBar}></View>
                <View style={styles.dex}>
                    <TouchableOpacity style={styles.backImgBox} onPress={() => {
                        this.props.navigation.goBack()
                    }}>
                        <Image source={Images.Vectorhh} style={{ width: 20, height: 20, resizeMode: 'contain' }}></Image>
                    </TouchableOpacity>
                    <View style={styles.search}>
                        <TextInput
                            style={styles.searchs}
                            onChangeText={text => this.onChangeText(text)}
                            value={this.state.searchText}
                            placeholder={"搜索用户/社圈/机构"}
                            inlineImageLeft='search'
                            autoFocus={true}
                            maxLength={5}
                        // onBlur={() => {
                        //     if (this.state.searchText != '') {
                        //     } else {
                        //         this.setState({ judges: false })
                        //     }
                        // }}
                        />

                        <View style={{
                            display: 'flex',
                            flexDirection: 'row',
                            alignItems: 'center',
                            position: 'absolute',
                            right: 5,
                            top: 5,
                        }}>
                            <TouchableOpacity style={{ marginRight: 15 }} onPress={() => {
                                // this.props.navigation.push('screens')
                            }}>
                                <Image source={Images.Vectojj} style={{ width: 15, height: 15, resizeMode: "contain" }}></Image>
                            </TouchableOpacity>
                            <Text onPress={() => {

                                if (this.state.searchText == '') {
                                    this.setState({
                                        judges: this.state.judges = 0,
                                        DATAS: [],
                                        DATASS: [],
                                        Socialcircle: []
                                    })
                                } else {
                                    this.setState({
                                        judges: this.state.judges = 1,
                                        DATAS: [],
                                        DATASS: [],
                                        Socialcircle: []
                                    })
                                    //找人
                                    this.lookforsb()
                                    //社圈
                                    this.Socialcircle()
                                    this.getUserMaillistS()
                                }
                            }} style={styles.searchsText} >搜索</Text>
                        </View>

                    </View>

                </View>
                {/* this.state.judges ? styles.judgess : styles.judge */}
                <View style={this.state.judges == 1 ? styles.judgesss : styles.judge}>
                    {this.state.DATAS.length == 0 && this.state.Socialcircle.length == 0 && this.state.DATASS.length == 0 ? bothNull :
                        <View style={styles.judgesss}>
                            <View style={styles.lookforsb}>
                                <View style={{ flexDirection: 'row' }}>
                                    <Text onPress={() => {
                                        this.setState({
                                            lookforsbsisok: 0
                                        })
                                    }} style={this.state.lookforsbsisok == 0 ? styles.lookforsbs : styles.lookforsbsos} >找人</Text>
                                    <Text onPress={() => {
                                        this.setState({
                                            lookforsbsisok: 1
                                        })
                                    }} style={this.state.lookforsbsisok == 1 ? styles.lookforsbs : styles.lookforsbsos}>找社圈</Text>
                                    <Text onPress={() => {
                                        this.setState({
                                            lookforsbsisok: 2
                                        })
                                    }} style={this.state.lookforsbsisok == 2 ? styles.lookforsbs : styles.lookforsbsos}>找机构</Text>
                                </View>

                            </View>
                            {/* {this.state.DATAS.length == 0 && this.state.Socialcircle.length == 0 ? bothNull : null} */}
                            {/* 找人 */}
                            {this.state.DATAS.length != 0 ? FindsomeonePHP : Subscribe}
                            {/* 社圈 */}
                            {this.state.Socialcircle.length != 0 ? mySocialCircle : Subscribe1}
                            {/* 公司 */}
                            {this.state.DATASS.length != 0 ? FindenterprisePHP : Subscribe2}
                        </View>}

                </View>
                {/* 搜索列表 */}
                {canmint}
                {/* {canmint}
                {results} */}

            </View>
        )
    }
}
const styles = StyleSheet.create({
    comment: {
        flex: 1,
        // padding: 20
    }
    ,
    dex: {
        display: 'flex',
        flexDirection: 'row',
        alignItems: 'center',
        // alignContent: 'center',
        // textAlign: 'center',
        // marginTop: 30,
        // width: '100%',
        width: '100%',
        padding: 20
        // marginTop: 10,
    },
    backImgBox: {
        width: '5%',
        marginRight: 15,
        display: 'flex',
        alignItems: 'center',
        justifyContent: 'center'
    },
    dexj0: {
        // marginTop: 15,
        display: 'flex',
        flexDirection: 'row',
        // textAlign: 'center',
        // height: 30,
        // lineHeight: 30,
        // paddingLeft: 20,
        // paddingRight: 20,
        // paddingTop: 20,
        width: "100%",
        // marginTop: 30,
        alignItems: 'center',
        justifyContent: 'space-between'
    },
    dexj: {
        marginTop: 15,
        display: 'flex',
        flexDirection: 'row',
        textAlign: 'center',
        // height: 30,
        // paddingLeft: 20,
        // paddingRight: 20,
        paddingTop: 20,
        // lineHeight: 30,
        // width: "80%",
        // marginTop: 30,
        alignItems: 'center',
        justifyContent: 'space-between'
    },
    search: {
        width: '95%',
        // display: 'flex',
        // justifyContent: 'space-around',
        // flexDirection: 'row',
        // alignContent: 'center',
        backgroundColor: '#C4C4C440',
        position: 'relative',
        borderRadius: 6,
        flex: 1
    },
    searchs: {
        paddingLeft: "5%",
        height: 40,
        width: '100%'
        // marginRight: 60,
        // TextIndent: 20
    },
    searchsText: {
        height: 30,
        width: 50,
        backgroundColor: '#BEDFFF',
        color: '#0081F9',
        textAlign: 'center',
        lineHeight: 30,
        borderRadius: 6,
        // marginRight: 1,
    },
    Searchlisthss: {
        flexDirection: 'row',
        // marginTop: 20,
        flexWrap: 'wrap',
        justifyContent: 'space-between',
        // paddingLeft: 20,
        // paddingRight: 20,
        width: '100%'
    },
    Searchlisthses: {
        flexDirection: 'row',
        flexWrap: 'wrap',
        height: 300,
        // paddingLeft: 20,
        // paddingRight: 20,
    },
    tailos: {
        fontSize: 19,
        color: 'black',
    },
    tailses: {
        flexDirection: 'row',
        marginTop: 20
    },
    tailsTextss: {
        marginLeft: "5%",
        marginRight: 90,
        color: '#787878'
    },
    childsss: {
        marginLeft: 20,
        marginRight: 130
    },
    judge: {
        display: 'none'
    },
    judgess: {
        flex: 1,
        marginLeft: 20,
        marginRight: 20
    },
    judgesss: {
        flex: 1,
    },
    Searchcontent: {
        display: 'flex',
        justifyContent: 'space-around',
        flexDirection: 'row',
        alignContent: 'center',
        backgroundColor: '#C4C4C440',
        borderRadius: 6
    },
    query: {
        height: 40,
        width: 50,
        backgroundColor: '#BEDFFF',
        color: '#0081F9',
        textAlign: 'center',
        lineHeight: 40,
        borderRadius: 6,
        marginRight: 10,
        marginTop: 5
    },
    lookforsb: {
        display: 'flex',
        flexDirection: 'row',
        justifyContent: 'space-between',
        // marginTop: 20,
        height: 30,
        borderBottomWidth: 1,
        borderBottomColor: 'rgba(0, 0, 0, 0.07)',
        // alignItems: 'center'
    },
    lookforsbs: {
        color: 'black',
        marginLeft: 30,
        height: 30,
        borderBottomWidth: 2,
        borderBottomColor: 'blue'
    },
    middle: {
        display: 'flex',
        flexDirection: 'row',
        // marginTop: 20,
        marginBottom: 10,
        paddingBottom: 10,
        borderBottomWidth: 1,
        borderBottomColor: "rgba(0, 0, 0, 0.08)",
        width: "100%",
        position: 'relative'
        // justifyContent: 'space-between',
        // width: "88%"
    },
    middleText: {
        fontSize: 11,
        color: '#1890FF',
        borderColor: '#1890FF',
        borderWidth: 1,
        padding: 2,
        borderRadius: 3,
        // width: 60,
        // height: 20,
        textAlign: 'center',
        // lineHeight: 20,
        marginRight: 5
    },
    tall: {
        marginTop: 3
    },
    learnView: {
        // paddingTop: 30,
        marginTop: 10,
        marginLeft: 20,
        marginRight: 20,
        // marginBottom: 20
        // alignItems: 'center',
        // justifyContent: 'space-between'
    },
    container: {
        flexDirection: "row",
        alignItems: "center",
        justifyContent: "center",
        paddingVertical: 10
    },
    tabBtn: {
        width: "25%",
        paddingVertical: 5,
        paddingHorizontal: 40,
        alignItems: "center",
        borderWidth: 1,
    },

    Searchrecords: {
        width: "45%", fontSize: 13, marginTop: 15, color: '#787878',
    }
    ,
    mySocialCircle: {
        display: "flex",
        backgroundColor: "white",
        borderRadius: 10,
        marginBottom: 20,
        marginLeft: 15,
        marginRight: 15
    },
    uploadBoxContainer: {
        padding: 15,
        display: "flex",
    },
    uploadBoxHeadPortrait: {
        display: "flex",
        flexDirection: "row",
        marginBottom: 10
    },
    headPortrait: {
        width: 50,
        height: 50,
        borderRadius: 25,
        // resizeMode: "contain"
    },
    headPortraitText: {
        height: 50,
        lineHeight: 50,
        marginLeft: 15
    },
    headPortraitName: {
        height: 25,
        lineHeight: 25,
        fontWeight: 'bold'
    },
    headPortraitTime: {
        height: 25,
        lineHeight: 25,
        color: "rgba(0,0,0,0.4)"
    },
    textContent: {
        // marginTop: 10,
        // marginBottom: 10,
        flexDirection: "row",
        alignItems: "center",
        flexWrap: "wrap",
        marginBottom: 10,
        fontWeight: '700',
    },
    textContentFont: {
        fontSize: 16,
        // marginRight: 10
    },
    textContentLabel: {
        color: "#006DBC",
        fontSize: 13
    },
    locationBox: {
        display: "flex",
        flexDirection: "row",
        marginBottom: 10
    },
    locationBoxImage: {
        width: 20,
        height: 20,
        resizeMode: "contain"
    },
    locationBoxFont: {
        marginLeft: 5,
        color: 'rgba(103, 103, 103, 1)'
    },
    timesBox: {
        display: "flex",
        flexDirection: "row",
        // marginTop: 10,
        justifyContent: "space-between"
    },
    timesViews: {
        display: "flex",
        flexDirection: "row"
    },
    timesViewsImage: {
        width: 20, height: 20,
        resizeMode: "contain"
    },
    timesViewsFont: {
        color: "rgba(0,0,0,0.4)",
        marginLeft: 5
    },
    likeCommentBox: {
        display: "flex",
        flexDirection: "row"
    },
    likeBox: {
        display: "flex",
        flexDirection: "row"
    },
    likeBoxImage: {
        width: 20,
        height: 20,
        resizeMode: "contain"
    },
    likeBoxFont: {
        color: "rgba(0,0,0,0.6)"
    },
    commentBox: {
        display: "flex",
        flexDirection: "row",
        marginLeft: 15
    },
    commentBoxImage: {
        width: 20,
        height: 20,
        resizeMode: "contain"
    },
    commentBoxFont: {
        color: "rgba(0,0,0,0.6)"
    },
    row: {
        flexDirection: "row",
        justifyContent: 'flex-start',
        flexWrap: "wrap",
        marginBottom: 10
    },
    labelRow: {
        flexDirection: "row",
        flexWrap: "wrap",
        marginBottom: 10
    },
    item: {
        flexDirection: "row",
        justifyContent: "space-between",
        width: '32%',
        // marginBottom: 4,
        height: 100
    },
    itemMr: {
        flexDirection: "row",
        justifyContent: "space-between",
        width: '32%',
        // marginTop: 10,
        marginRight: "2%",
        height: 100,
    },
    SystemPrompt: {
        width: "100%",
        height: 100,
    },
    lookforsbsos: {
        color: 'rgba(0, 0, 0, 0.43)',
        marginLeft: 30,
        height: 30,

    },
    bottom_container: {
        height: 100,
        flex: 1,
        alignItems: "center",
        justifyContent: "center"
    },
    bottom_text: {
        color: "rgba(196, 196, 196, 1)"
    },
    Personalhomepagepicture: {
        fontSize: 15, color: 'black', fontWeight: 'bold'
    },
    Personalcirculation: {
        display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between'
    },
    Searchlistmodule: {
        fontSize: 19, color: 'black',
    },
    bothNullImg: {
        width: "100%",
        resizeMode: 'contain'
    },
    subscribe_style: {

        paddingVertical: 80,
        justifyContent: 'center',
        alignItems: 'center',
        margin: 10,
        // backgroundColor: '#ddd'
    }, no_subscribe_text: {
        fontSize: 17,
        color: "rgba(196, 196, 196, 1)"
    },
    IndicatorContainer: {
        alignItems: "center"
    },
    headPortraitBox: {
        width: 50,
        height: 50,
        borderRadius: 25,
    },
    statusBar: {
        width: width,
        height: statusBarHeight,
        backgroundColor: 'transparent',
    },
    introduce_img: {
        width: 15,
        height: 15,
        marginTop: 3,
        marginLeft: 5
    },
})